<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class CommentController extends Controller
{
	
	// 显示详情s
	public function getInsert(Request $request)
	{
		//写入评论
		$uid=$request->input('uid');
		if($uid){
		$xx=$request->only('interest','rating','tags','comment','uid','gid');
		$gid=$request->input('id');
		$xx['date']=date('Y-m-d H:i:s',time());
		$xx['gid']=$gid;
	
			// 执行插入语句
				$res=DB::table('comment')->insert($xx);
				// dd($res);
				$a = ['id'=>$gid];
				// dd($a);
				$b = $a['id'];
				// dd($res);
				// 判断是否插入成功
				if($res){
				
					return redirect('/home/xiangqing/show/'.$b);
					// return view('home.xiangqing.xiangqing',['id',$gid]);

				}else{
					return black();
				}
		
		}else{
			return view('home.login.login');
		}
	}
}


?>